<div id="middle">
    <div id="slide-show">
		<table cellspacing="0" cellpadding="0" border="0">
			<tbody>
				<tr>
					<?php foreach ($slide_shows as $slide_show): ?>
						<td>
							<a href="<?php echo empty($slide_show->link) ? 'javascript:void(0);' : $slide_show->link; ?>" class="image-container">
								<img src="/assets/upload/img/<?php echo $slide_show->image_name; ?>" alt="slide-show"/> 
							</a>
							<p>
								<?php echo $slide_show->description; ?>
							</p>
						</td>
					<?php endforeach; ?>
				</tr>
			</tbody>
		</table>
		<ul>
			<?php for ($i = 1; $i < count($slide_shows) + 1; $i++): ?>
				<li><a href="javascript:void(0);"><?php echo $i; ?></a></li>
			<?php endfor; ?>
		</ul>
    </div>

    <dl id="projects">
		<dt>RECENT PROJECTS</dt>
		<?php foreach ($projects as $key => $project): ?>
			<dd<?php echo ($key + 1) % 4 ? '' : ' class="change-line"'; ?>>
				<a href="/project/show/<?php echo $project->id; ?>">
					<img src="/assets/upload/img/<?php echo $project->cover_name; ?>" alt="project"/>
					<span class="content">
						<?php echo $project->name; ?>
						<span><?php echo str_replace("\n", '<br/>', $project->summary); ?></span>
					</span>
				</a>
			</dd>
		<?php endforeach; ?>
    </dl>

    <dl id="news">
		<dt>RECENT NEWS</dt>
		<?php for ($i = 0; $i < 6; $i++): ?>
			<dd class="news-<?php echo $i; ?>">
				<?php if (isset($news) && isset($news[$i])): ?>
					<a href="/news/show/<?php echo $news[$i]->id; ?>">
						<img src="/assets/upload/img/<?php echo $news[$i]->cover_name; ?>" alt="news"/>
					</a>
					<a href="/news/show/<?php echo $news[$i]->id; ?>">
						<?php echo my_substr($news[$i]->title, 26 ); ?>
					</a>
					<p><?php echo my_substr(plain_text($news[$i]->content), $words[$i]); ?></p>
					<div class="date">
						<h4><?php echo date('M', strtotime($news[$i]->created_at)); ?></h4>
						<h3><?php echo date('d', strtotime($news[$i]->created_at)); ?></h3>
					</div>
				<?php endif; ?>
			</dd>
		<?php endfor; ?>
    </dl>
</div>